package ru.myrtle.umf.query.condition.object;

import ru.myrtle.umf.UClass;

public enum UObjectTypeRelation {

    EQUAL {

        @Override
        public boolean check(UClass c1, UClass c2) {
            return c1 == c2;
        }
    },

    ANCESTOR {

        @Override
        public boolean check(UClass c1, UClass c2) {
            return c1.isSuperType(c2);
        }
    },

    DIRECT_ANCESTOR {

        @Override
        public boolean check(UClass c1, UClass c2) {
            return c2.isDirectSuperType(c1);
        }
    },

    DESCENDANT {

        @Override
        public boolean check(UClass c1, UClass c2) {
            return c2.isSuperType(c1);
        }
    },

    DIRECT_DESCENDANT {

        @Override
        public boolean check(UClass c1, UClass c2) {
            return c1.isDirectSuperType(c2);
        }
    };

    public abstract boolean check(UClass c1, UClass c2);
}
